function calculatedDefaultFor(data, type) {
    if (isNotEmpty(data) && data instanceof Array) {
        //先获取itemNBR
        var itemNbr = data[0].ITEM_NBR;
        var size = data[0].VNPK_QTY;
        var rate = data[0].TAX_RATE;
        var dataList = [];
        for (var i = 0; i < data.length; i++) {
            var datum = data[i];
            if (type === 'new-cost') {
                if (isNotEmpty(datum.NEW_CASE_COST)) {
                    dataList.push({
                        itemNbrT: itemNbr,
                        effDate: datum.NEW_COST_EFF_DATE,
                        expDate: datum.NEW_COST_EXP_DATE,
                        priceType: 'CS',
                        cost: datum.NEW_CASE_COST,
                        priceTrait: null,
                        size: size,
                        rate: rate,
                        type: 'new',
                        comment: ''
                    });
                }
            } else if (type === 'new-retail') {
                if (isNotEmpty(datum.NEW_RETAIL)) {
                    dataList.push({
                        itemNbrT: itemNbr,
                        effDate: datum.NEW_RETAIL_EFF_DATE,
                        expDate: datum.NEW_RETAIL_EXP_DATE,
                        priceType: datum.RETAIL_TYPE,
                        retail: datum.NEW_RETAIL,
                        priceTrait: datum.TRAIT_STORE_NBR,
                        size: size,
                        rate: rate,
                        type: 'new',
                        comment: ''
                    });
                }
            } else if (type === 'old-cost') {
                if (isNotEmpty(datum.VNPK_PPD_COST_AMT)) {
                    dataList.push({
                        itemNbrT: itemNbr,
                        effDate: datum.EFFECTIVE_DATE,
                        expDate: datum.EXPIRATION_DATE,
                        priceType: datum.PRICE_TYPE,
                        cost: datum.VNPK_PPD_COST_AMT,
                        priceTrait: datum.PRICE_TRAIT,
                        size: size,
                        rate: rate,
                        type: 'old',
                        comment: ''
                    });
                }
            } else if (type === 'old-retail') {
                if (isNotEmpty(datum.CUST_BASE_RTL_AMT)) {
                    dataList.push({
                        itemNbrT: itemNbr,
                        effDate: datum.EFFECTIVE_DATE,
                        expDate: datum.EXPIRATION_DATE,
                        priceType: datum.PRICE_TYPE,
                        retail: datum.CUST_BASE_RTL_AMT,
                        priceTrait: datum.PRICE_TRAIT,
                        size: size,
                        rate: rate,
                        type: 'old',
                        comment: ''
                    });
                }
            }
        }
        return dataList;
    } else if (isNotEmpty(data) && data instanceof Object) {
        var oldList = [];
        //先获取itemNBR
        var itemNbr2 = data.ITEM_NBR;
        var size2 = data.VNPK_QTY;
        var rate2 = data.TAX_RATE;
        var itemList = [];
        if (type === 'new-cost') {
            if (isNotEmpty(data.NEW_CASE_COST)) {
                return {
                    itemNbrT: itemNbr2,
                    effDate: data.NEW_COST_EFF_DATE,
                    expDate: data.NEW_COST_EXP_DATE,
                    cost: data.NEW_CASE_COST,
                    priceType: 'CS',
                    priceTrait: 45,
                    size: size2,
                    rate: rate2,
                    type: 'new'
                };
            }
        } else if (type === 'new-retail') {
            if (isNotEmpty(data.NEW_RETAIL)) {
                return {
                    itemNbrT: itemNbr2,
                    effDate: data.NEW_RETAIL_EFF_DATE,
                    expDate: data.NEW_RETAIL_EXP_DATE,
                    priceType: data.RETAIL_TYPE,
                    retail: data.NEW_RETAIL,
                    priceTrait: data.TRAIT_STORE_NBR,
                    size: size2,
                    rate: rate2,
                    type: 'new',
                    comment: ''
                };
            }

        }
        if (type === 'cost') {
            if (typeof data.JSON_CASECOST_LIST == "string") {
                oldList = JSON.parse(data.JSON_CASECOST_LIST);
            } else {
                oldList = data.JSON_CASECOST_LIST;
            }

        } else if (type === 'retail') {
            if (typeof data.JSON_CASECOST_LIST == "string") {
                oldList = JSON.parse(data.JSON_RETAIL_LIST);
            } else {
                oldList = data.JSON_RETAIL_LIST;
            }
        }
        for (var k = 0; k < oldList.length; k++) {
            var old = oldList[k];
            var effDate = oldList[k].EFFECTIVE_DATE;
            var expDate = oldList[k].EXPIRATION_DATE;
            var cost = oldList[k].VNPK_PPD_COST_AMT;
            var itemNbrList;
            // if (Date.parse(effDate)>now3){
            if (type === 'cost') {
                itemNbrList = {
                    itemNbrT: itemNbr2,
                    effDate: effDate,
                    expDate: expDate,
                    cost: cost,
                    size: size2,
                    rate: rate2,
                    priceType: old.PRICE_TYPE,
                    type: 'old'
                };
                itemList.push(itemNbrList);
            } else if (type === 'retail') {
                if (old.PRICE_TYPE === 'AR' || old.PRICE_TYPE === 'TR' || old.PRICE_TYPE === 'BP') {
                    itemNbrList = {
                        itemNbrT: itemNbr2,
                        effDate: effDate,
                        expDate: expDate,
                        priceType: old.PRICE_TYPE,
                        retail: old.CUST_BASE_RTL_AMT,
                        priceTrait: old.PRICE_TRAIT,
                        type: 'old',
                        size: size2,
                        rate: rate2,
                        comment: ''
                    };
                    itemList.push(itemNbrList);
                }
            }
        }
        return itemList;
    } else {
        return [];
    }
}
